package com.heima.admin.controller;

import com.heima.api.schedule.WemediaFeign;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.SensitiveDto;
import com.heima.model.wemedia.pojos.WmSensitive;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
@RequiredArgsConstructor
public class AdSensitiveController {

    private final WemediaFeign wemediaFeign;

    /**
     * 敏感词分页
     * @param dto
     * @return
     */
    @PostMapping("/list")
    public PageResponseResult sensitiveList(@RequestBody SensitiveDto dto){
        return wemediaFeign.sensitiveList(dto);
    }

    /**
     * 添加敏感词
     * @param sensitive
     * @return
     */
    @PostMapping("/save")
    public ResponseResult saveSensitive(@RequestBody WmSensitive sensitive){
        return wemediaFeign.saveSensitive(sensitive);
    }


    /**
     * 敏感词删除
     * @param id
     * @return
     */
    @DeleteMapping("/del/{id}")
    public ResponseResult deleteSensitiveById(@PathVariable Integer id){
        return  wemediaFeign.deleteSensitiveById(id);
    }

    /**
     * 敏感词修改
     * @param sensitive
     * @return
     */
    @PostMapping("/update")
    public ResponseResult updateSensitive(@RequestBody WmSensitive sensitive){
        return wemediaFeign.updateSensitive(sensitive);
    }


}
